<?php
namespace App\Traits;

use Facebook\WebDriver\Exception\WebDriverCurlException;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverBy;
use Facebook\WebDriver\WebDriverExpectedCondition;

trait WebDriverTrait {

    public static function isExists(RemoteWebDriver $driver, WebDriverBy $el, $wait = 10): bool
    {
        try {
            $driver->wait($wait)
                ->until(
                    WebDriverExpectedCondition::visibilityOfElementLocated(
                        $el
                    )
                );
            return true;

        } catch (\Exception|WebDriverCurlException $exception) {

        }
        return false;
    }



}
